import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.VITE_BASE_URL),
  routes: [
    {
      path: '/',
      name: 'Home',
      component: () => import('../views/Home.vue'),
      meta: {
        title: '熊猫书屋'
      }
    },
    {
      path: '/book/:id',
      name: 'BookDetail',
      component: () => import('../views/BookDetail.vue'),
      meta: {
        title: '书籍详情'
      }
    },
    {
      path: '/reader/:id/:chapter',
      name: 'Reader',
      component: () => import('../views/Reader.vue'),
      meta: {
        title: '阅读'
      }
    },
    {
      path: '/upload',
      name: 'Upload',
      component: () => import('../views/Upload.vue'),
      meta: {
        title: '上传电子书'
      }
    }
  ],
})

export default router
